const UserUtils = {
    //手机号验证
    mobileCheckout(modile) {
        var reg = /^1[3456789]\d{9}$/
        if (reg.test(modile)) {
            return true
        } else {
            return false
        }
    },
    //密码验证
    passwordCheckout(password) {
        var reg = /^[a-zA-Z]{1}([a-zA-Z0-9]|[_]){5,17}$/
        if (reg.test(password)) {
            return true
        } else {
            return false
        }
    },
    //保存token
    setToken(token){
        localStorage.setItem("token",token)
    },
    //获取token
    getToken(){
        return localStorage.getItem(token)
        
    },
    //验证token
    isLogin(){  
        var token=localStorage.token
        if(token){
            return true
        }else{
            return false
        }
    },
    //账户密码储存
    getUser(username,password){
        var list=[]
        list.push({
            username:username,
            password:password
        })
        localStorage.user=JSON.stringify(list)
    }
}
export default UserUtils